[題解] 中心八面體數

Posted on Thu, Oct 21, 2021 題解 C++
#include <bits/stdc++.h>

using namespace std;


long long dp[1900000];
long long a[1900000];
int main(){
    int temp;
    for(int i=0;i<1900000;i++){
        dp[i]=1+2*i*(i+1);
    }
    a[0]=1;
    for(int i=1;i<1900000;i++){
        a[i]=a[i-1]+dp[i]+dp[i-1];
        //cout<<i<<": "<<a[i]<<endl;
    }
    cout<<a[1899999]<<endl;

}
Centered octahedral number - Wikipedia

A centered octahedral number or Haüy octahedral number is a figurate number that counts the number of points of a three-dimensional integer lattice that lie inside an octahedron centered at the origin. The same numbers are special cases of the Delannoy numbers, which count certain two-dimensional lattice paths.